import {createApp} from 'vue'
import './style.css'
import App from './App.vue'
import ViewUIPlus from 'view-ui-plus'
import 'view-ui-plus/dist/styles/viewuiplus.css'
import ElementPlus from 'element-plus';
import 'element-plus/dist/index.css';
import store from './store';
// import "jqwidgets-scripts/jqwidgets/styles/jqx.base.css";

import {components} from "@/components/flow/component/index.js"

import router from './router'
// import VueCodemirror from 'vue-codemirror'
// import 'vue-codemirror/lib/codemirror.css'
// import 'vue-codemirror/node_modules/codemirror/lib/codemirror.css'
const debounce = (fn, delay) => {
    let timer = null;
    return function () {
        let context = this;
        let args = arguments;
        clearTimeout(timer);
        timer = setTimeout(function () {
            fn.apply(context, args);
        }, delay);
    }
}

const _ResizeObserver = window.ResizeObserver;
window.ResizeObserver = class ResizeObserver extends _ResizeObserver {
    constructor(callback) {
        callback = debounce(callback, 16);
        super(callback);
    }
}

var app = createApp(App);

for (const c of components) {
    app.component(c.name, c.data);
}

app.use(router).use(ViewUIPlus).use(store).use(ElementPlus).mount('#app')
